/** * 订单管理 交易订单 */
<template>
  <div>
    <!-- 面包屑导航 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/index' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>停车场管理</el-breadcrumb-item>
    </el-breadcrumb>
    <!-- 搜索筛选 -->
    <!-- <el-form :inline="true" :model="formInline" class="user-search">
      <el-form-item label="搜索：">
        <el-input size="small" v-model="formInline.machineNo" placeholder="输入终端编号"></el-input>
      </el-form-item>
      <el-form-item>
        <el-input size="small" v-model="formInline.orderNo" placeholder="输入订单号"></el-input>
      </el-form-item>
      <el-form-item>
        <el-input size="small" v-model="formInline.transId" placeholder="输入交易单号"></el-input>
      </el-form-item>
      <el-form-item>
        <el-select size="small" v-model="formInline.payType" placeholder="请选择">
          <el-option v-for="type in payType" :label="type.key" :value="type.value" :key="type.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-select size="small" v-model="formInline.orderStatus" placeholder="请选择">
          <el-option v-for="type in payway" :label="type.key" :value="type.value" :key="type.value"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button size="small" type="primary" icon="el-icon-search" @click="search">搜索</el-button>
      </el-form-item>
    </el-form> -->
    <el-button size="small" type="primary" @click="handleAdd">添加停车场</el-button>
<!--    <el-button size="small" type="primary" @click="selectParking">绑定停车场</el-button>-->
    <!--列表-->
    <!-- <el-table size="small" :data="listData" highlight-current-row v-loading="loading" border element-loading-text="拼命加载中" style="width: 100%;">
      <el-table-column align="center" type="index" width="60">
      </el-table-column>
      <el-table-column sortable prop="machineNo" label="终端编号" width="120" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="orderNo" label="订单号" width="120" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="transId" label="交易单号" width="120" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="payType" label="支付方式" width="140" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="transType" label="交易类型" width="120" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="goodsPrice" label="商品价格" width="120" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="payAmount" label="支付金额" width="180" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="goodsName" label="商品名称" width="140" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="orderStatus" label="订单状态" width="120" show-overflow-tooltip>
      </el-table-column>
      <el-table-column sortable prop="addTime" label="创建时间" width="180" show-overflow-tooltip>
        <template slot-scope="scope">
          <div>{{scope.row.addTime|timestampToTime}}</div>
        </template>
      </el-table-column>
      <el-table-column align="center" label="操作" min-width="150">
        <template slot-scope="scope">
          <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">预览</el-button>
          <el-button size="mini" type="danger" @click="deleteUser(scope.$index, scope.row)">退款</el-button>
        </template>
      </el-table-column>
    </el-table> -->
    <el-table size="small" :data="listData" highlight-current-row v-loading="loading" border
      element-loading-text="拼命加载中" style="width: 100%">
      <el-table-column align="center" type="index" width="60" />
      <!-- <el-table-column sortable prop="id" label="id" width="120" show-overflow-tooltip/> -->
      <el-table-column sortable prop="name" label="停车场名" width="150" show-overflow-tooltip />
      <el-table-column sortable prop="address" label="停车场位置" width="150" show-overflow-tooltip />
      <!-- <el-table-column sortable prop="photo" label="停车场照片" width="120" show-overflow-tooltip/> -->
      <el-table-column sortable prop="total" label="总车位" width="100" show-overflow-tooltip />
      <el-table-column sortable prop="surplus" label="剩余车位" width="100" show-overflow-tooltip />
      <el-table-column sortable prop="price" label="价格" width="80" show-overflow-tooltip />
      <el-table-column align="center" label="操作" min-width="120">
        <template slot-scope="scope">
          <!-- <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">修改价格</el-button> -->
          <!-- <el-button size="mini" type="danger" @click="deleteUser(scope.$index, scope.row)">退款</el-button> -->
          <el-button size="mini" @click="handleShow(scope.$index, scope.row)">查看详细信息</el-button>
          <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">修改信息</el-button>
          <el-button size="mini" type="danger" @click="deleteUser(scope.$index, scope.row)">删除停车场</el-button>
        </template>
      </el-table-column>
    </el-table>
    <!-- 分页组件 -->
    <!-- <Pagination v-bind:child-msg="pageparm" @callFather="callFather"></Pagination> -->
    <!-- 信息展示界面 -->
    <el-dialog :title="title" :visible.sync="showFormVisible" width="50%" @click="closeDialog('editForm')">
      <el-form label-width="120px" :model="editForm" ref="editForm">
        <el-row>
          <el-col :span="12">
            <el-form-item label="停车场照片">
              <img v-if="editForm.photo" :src="editForm.photo" class="avatar">
              <!-- <el-input size="small" v-model="editForm.photo" auto-complete="off" placeholder="请输入名称" disabled></el-input> -->
            </el-form-item>
            <el-form-item label="停车场经度">
              <el-input size="small" v-model="editForm.longitude" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item>
            <el-form-item label="停车场维度">
              <el-input size="small" v-model="editForm.latitude" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="停车场编号">
              <el-input size="small" v-model="editForm.id" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item>
            <el-form-item label="停车场名">
              <el-input size="small" v-model="editForm.name" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item>
            <el-form-item label="停车场地址">
              <el-input size="small" v-model="editForm.address" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item>
            <el-form-item label="停车场容量">
              <el-input size="small" v-model="editForm.total" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item>
            <el-form-item label="停车场剩余车位">
              <el-input size="small" v-model="editForm.surplus" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item>
            <el-form-item label="停车场价格">
              <el-input size="small" v-model="editForm.price" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item>


          </el-col>


        </el-row>


      </el-form>


    </el-dialog>

    <!-- 编辑界面 -->
    <el-dialog :title="title" :visible.sync="editFormVisible" width="50%" @click="closeDialog('editForm')">
      <el-form label-width="120px" :model="editForm" ref="editForm">
        <!-- <el-row>
          <el-col :span="12">
            <el-form-item label="公司编号">
              <el-input size="small" v-model="editForm.deptId" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item>
            <el-form-item label="订单号">
              <el-input size="small" v-model="editForm.orderNo" auto-complete="off" placeholder="请输入商户号" disabled></el-input>
            </el-form-item>
            <el-form-item label="支付方式">
              <el-input size="small" v-model="editForm.payType" auto-complete="off" placeholder="请输入商户号" disabled></el-input>
            </el-form-item>
            <el-form-item label="交易类型">
              <el-input size="small" v-model="editForm.transType" auto-complete="off" placeholder="请输入微信子商户" disabled></el-input>
            </el-form-item>
            <el-form-item label="商品编号">
              <el-input size="small" v-model="editForm.goodsNo" auto-complete="off" placeholder="请输入应用ID" disabled></el-input>
            </el-form-item>
            <el-form-item label="支付金额">
              <el-input size="small" v-model="editForm.payAmount" auto-complete="off" placeholder="请输入通知回调" disabled></el-input>
            </el-form-item>
            <el-form-item label="货道号">
              <el-input size="small" v-model="editForm.aisleNo" auto-complete="off" placeholder="请输入加密类型" disabled></el-input>
            </el-form-item>
            <el-form-item label="买家标识">
              <el-input size="small" v-model="editForm.openId" auto-complete="off" placeholder="请输入商户签名密钥" disabled></el-input>
            </el-form-item>
            <el-form-item label="子商户号">
              <el-input size="small" v-model="editForm.subMchId" auto-complete="off" placeholder="请输入支付宝卖家" disabled></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="公司名称">
              <el-input size="small" v-model="editForm.deptName" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item>
            <el-form-item label="交易单号">
              <el-input size="small" v-model="editForm.transId" auto-complete="off" placeholder="请输入商户号" disabled></el-input>
            </el-form-item>
            <el-form-item label="子支付方式">
              <el-input size="small" v-model="editForm.subPayType" auto-complete="off" placeholder="请输入商户号" disabled></el-input>
            </el-form-item>
            <el-form-item label="终端编号">
              <el-input size="small" v-model="editForm.machineNo" auto-complete="off" placeholder="请输入微信子商户" disabled></el-input>
            </el-form-item>
            <el-form-item label="商品价格">
              <el-input size="small" v-model="editForm.goodsPrice" auto-complete="off" placeholder="请输入应用ID" disabled></el-input>
            </el-form-item>
            <el-form-item label="商品名称">
              <el-input size="small" v-model="editForm.goodsName" auto-complete="off" placeholder="请输入通知回调" disabled></el-input>
            </el-form-item>
            <el-form-item label="订单状态">
              <el-input size="small" v-model="editForm.orderStatus" auto-complete="off" placeholder="请输入加密类型" disabled></el-input>
            </el-form-item>
            <el-form-item label="商户号">
              <el-input size="small" v-model="editForm.mchId" auto-complete="off" placeholder="请输入商户签名密钥" disabled></el-input>
            </el-form-item>
            <el-form-item label="编辑用户">
              <el-input size="small" v-model="editForm.editUser" auto-complete="off" placeholder="请输入支付宝卖家" disabled></el-input>
            </el-form-item>
          </el-col>
        </el-row> -->
        <!-- <el-form-item label="备注">
          <el-input size="small" v-model="editForm.remark" auto-complete="off" placeholder="请输入微信证书路径" disabled></el-input>
        </el-form-item> -->
        <el-row>
          <el-col :span="12">
            <el-form-item label="停车场照片">
              <el-upload
              class="avatar-uploader"
              action="http://localhost:80/parking/photo"
              :show-file-list="false"
              :on-success="handleAvatarSuccess"
              :before-upload="beforeAvatarUpload">
              <img v-if="editForm.photo" :src="editForm.photo" class="avatar">
              <i v-else class="el-icon-plus avatar-uploader-icon"></i>
            </el-upload>
              <!-- <el-input size="small" v-model="editForm.photo" auto-complete="off" placeholder="请输入名称" ></el-input> -->
            </el-form-item>
            <el-form-item label="停车场经度">
              <el-input size="small" v-model="editForm.longitude" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item>
            <el-form-item label="停车场维度">
              <el-input size="small" v-model="editForm.latitude" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item>
            <el-form-item>
              <el-button size="mini"  @click="handleSetLocation(editForm.id)">修改位置信息</el-button>
            </el-form-item>



          </el-col>


          <el-col :span="12">
            <el-form-item label="停车场编号">
              <el-input size="small" v-model="editForm.id" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item>
            <el-form-item label="停车场名">
              <el-input size="small" v-model="editForm.name" auto-complete="off" placeholder="请输入名称" ></el-input>
            </el-form-item>
            <el-form-item label="停车场地址">
              <el-input size="small" v-model="editForm.address" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item>
            <el-form-item label="停车场容量">
              <el-input size="small" v-model="editForm.total" auto-complete="off" placeholder="请输入名称" ></el-input>
            </el-form-item>
            <el-form-item label="停车场剩余车位">
              <el-input size="small" v-model="editForm.surplus" auto-complete="off" placeholder="请输入名称" ></el-input>
            </el-form-item>
            <el-form-item label="停车场价格">
              <el-input size="small" v-model="editForm.price" auto-complete="off" placeholder="请输入名称" ></el-input>
            </el-form-item>


          </el-col>


        </el-row>


      </el-form>
      <el-form>
        <el-button size="mini"  @click="handlePutData" >确认修改</el-button>
      </el-form>


    </el-dialog>

    <!-- 定位界面 -->
    <el-dialog :title="title" :visible.sync="setLocationVisible" width="50%" @click="closeDialog('editForm')">
      <el-form label-width="120px" :model="editForm" ref="editForm">
        <addParking></addParking>
      </el-form>
      <el-form>
        <el-button size="mini"  @click="handleSetData" >修改为选择位置</el-button>
      </el-form>

    </el-dialog>

    <!-- 添加界面 -->
    <el-dialog :title="title" :visible.sync="addFormVisiable" width="50%" @click="closeDialog('editForm')">
      <el-form label-width="120px" :model="editForm" ref="editForm">
        <el-row>
          <el-col :span="12">
            <el-form-item label="停车场照片">
              <el-upload
                class="avatar-uploader"
                action="http://localhost:80/parking/photo"
                :show-file-list="false"
                :on-success="handleAvatarSuccess"
                :before-upload="beforeAvatarUpload">
                <img v-if="imageUrl" :src="imageUrl" class="avatar">
                <i v-else class="el-icon-plus avatar-uploader-icon"></i>
              </el-upload>
              <!-- <el-input size="small" v-model="editForm.photo" auto-complete="off" placeholder="请输入名称" ></el-input> -->
            </el-form-item>
            <el-form-item label="停车场经度">
              <el-input size="small" v-model="editForm.longitude" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item>
            <el-form-item label="停车场维度">
              <el-input size="small" v-model="editForm.latitude" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item>
            <el-form-item>
              <el-button size="mini"  @click="handleSetLocation(editForm.id)">设置停车场位置信息</el-button>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <!-- <el-form-item label="停车场编号">
              <el-input size="small" v-model="editForm.id" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item> -->
            <el-form-item label="停车场名">
              <el-input size="small" v-model="editForm.name" auto-complete="off" placeholder="请输入名称" ></el-input>
            </el-form-item>
            <el-form-item label="停车场地址">
              <el-input size="small" v-model="editForm.address" auto-complete="off" placeholder="请输入名称" disabled></el-input>
            </el-form-item>
            <el-form-item label="停车场容量">
              <el-input size="small" v-model="editForm.total" auto-complete="off" placeholder="请输入名称" ></el-input>
            </el-form-item>
            <el-form-item label="停车场剩余车位">
              <el-input size="small" v-model="editForm.surplus" auto-complete="off" placeholder="请输入名称" ></el-input>
            </el-form-item>
            <el-form-item label="停车场价格">
              <el-input size="small" v-model="editForm.price" auto-complete="off" placeholder="请输入名称" ></el-input>
            </el-form-item>


          </el-col>


        </el-row>


      </el-form>
      <el-form>
        <el-button size="mini"  @click="handlePutData" >确认添加</el-button>
      </el-form>


    </el-dialog>

    <!-- 绑定停车场 -->
    <el-dialog :title="title" :visible.sync="selectParkingVisiable" width="50%" @click="closeDialog('editForm')">
      <el-form label-width="120px" :model="editForm" ref="editForm">
        <el-table size="small" :data="listData" highlight-current-row v-loading="loading" border
        element-loading-text="拼命加载中" style="width: 100%">
          <el-table-column align="center" type="index" width="60" />
          <!-- <el-table-column sortable prop="id" label="id" width="120" show-overflow-tooltip/> -->
          <el-table-column sortable prop="name" label="停车场名" width="150" show-overflow-tooltip />
          <el-table-column sortable prop="address" label="停车场位置" width="150" show-overflow-tooltip />
          <!-- <el-table-column sortable prop="photo" label="停车场照片" width="120" show-overflow-tooltip/> -->
          <el-table-column sortable prop="total" label="总车位" width="100" show-overflow-tooltip />
          <!-- <el-table-column sortable prop="surplus" label="剩余车位" width="100" show-overflow-tooltip /> -->
          <el-table-column sortable prop="price" label="价格" width="80" show-overflow-tooltip />
          <el-table-column align="center" label="操作" min-width="120">
            <template slot-scope="scope">
              <!-- <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">修改价格</el-button> -->
              <!-- <el-button size="mini" type="danger" @click="deleteUser(scope.$index, scope.row)">退款</el-button> -->
              <!-- <el-button size="mini" @click="handleShow(scope.$index, scope.row)">查看详细信息</el-button> -->
              <!-- <el-button size="mini" @click="handleEdit(scope.$index, scope.row)">修改信息</el-button> -->
              <!-- <el-button size="mini" type="danger" @click="setPrice(scope.row.id)">删除停车场</el-button> -->
              <el-button size="mini" >添加停车场</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-form>
      <!-- <el-form>
        <el-button size="mini"  @click="handlePutData" >确认绑定</el-button>
      </el-form> -->


    </el-dialog>

  </div>
</template>

<script>
import { managerPrice, showInfo, managerInfo, enrollInfo, delInfo } from "../../api/jiangMG";
import addParking from './AddParking';
// import Pagination from '../../components/Pagination';
export default {
  data() {
    return {
      loading: false, //是显示加载
      showFormVisible: false, //展示信息页面的显示与异常
      editFormVisible: false, //控制编辑页面显示与隐藏
      setLocationVisible: false, //定位
      addFormVisiable: false, //添加页面显示
      selectParkingVisiable: false,
      title: "停车场信息",
      imageUrl: '',
      payType: [
        { key: "请选择", value: 0 },
        { key: "现金", value: 1 },
        { key: "支付宝", value: 2 },
        { key: "微信", value: 3 },
        { key: "POS通", value: 4 },
        { key: "闪付", value: 5 },
        { key: "POS通C扫B", value: 6 },
        { key: "银联二维码", value: 8 },
        { key: "会员余额支付", value: 9 }
      ],
      payway: [
        { key: "请选择", value: 0 },
        { key: "初始化", value: 1 },
        { key: "已支付", value: 2 },
        { key: "出货成功", value: 3 },
        { key: "出货失败", value: 4 },
        { key: "订单超时", value: 5 },
        { key: "退款初始化", value: 11 },
        { key: "退款进行中", value: 12 },
        { key: "退款成功", value: 13 },
        { key: "退款失败", value: 14 },
        { key: "订单处理中", value: 10 }
      ],
      editForm: {
        // id: '',
        // name: '',
        // payType: 1,
        // partner: '',
        // subMchId: '',
        // appid: '',
        // notifyUrl: '',
        // signType: '',
        // partnerKey: '',
        // sellerUserId: '',
        // certPath: '',
        // certPassword: '',
        // rsaKey: '',
        // token: localStorage.getItem('logintoken')
        id: 15,
        name: "test",
        address: "sad",
        photo: "",
        longitude: "",
        latitude: "",
        total: 0,
        surplus: 0,
        price: 0
      },
      enrollForm: {
        id: 0,
        name: "",
        address: "",
        photo: "",
        longitude: "",
        latitude: "",
        total: 0,
        surplus: 0,
        price: 0
      },
      formInline: {
        page: 1,
        limit: 10,
        machineNo: "",
        orderNo: "",
        transId: "",
        payType: 0,
        orderStatus: 0,
        token: localStorage.getItem("logintoken")
      },
      // 删除部门
      seletedata: {
        ids: "",
        token: localStorage.getItem("logintoken")
      },
      userparm: [], //搜索权限
      listData: [], //用户数据
      parkinglist: [], //停车场列表
      // 分页参数
      pageparm: {
        currentPage: 1,
        pageSize: 10,
        total: 10
      }
    };
  },
  // 注册组件
  components: {
    // Pagination
    addParking
  },
  /**
   * 数据发生改变
   */
  /**
   * 创建完毕
   */
  created() {
    this.getdata(this.formInline);
  },
  /**
   * 里面的方法只有被调用才会执行
   */
  methods: {
    // 获取公司列表
    getdata(parameter) {
      this.loading = true;
      // 模拟数据开始
      // let res = {
      //   code: 0,
      //   msg: null,
      //   count: 23,
      //   data: [
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       photo: "zp",
      //       longitude: 'jingdu',
      //       latitude: 'weidu',
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     },
      //     {
      //       id: 15,
      //       name: "test",
      //       address: "sad",
      //       total: 0,
      //       surplus: 0,
      //       price: 0
      //     }
      //   ]
      // };
      // this.loading = false;
      // this.listData = res.data;
      // this.pageparm.currentPage = this.formInline.page;
      // this.pageparm.pageSize = this.formInline.limit;
      // this.pageparm.total = res.count;
      // 模拟数据结束
      /***
       * 调用接口，注释上面模拟数据 取消下面注释
       */
      // OrderList(parameter)
      //   .then(res => {
      //     this.loading = false
      //     if (res.success == false) {
      //       this.$message({
      //         type: 'info',
      //         message: res.msg
      //       })
      //     } else {
      //       this.listData = res.data
      //       // 分页赋值
      //       this.pageparm.currentPage = this.formInline.page
      //       this.pageparm.pageSize = this.formInline.limit
      //       this.pageparm.total = res.count
      //     }
      //   })
      //   .catch(err => {
      //     this.loading = false
      //     this.$message.error('菜单加载失败，请稍后再试！')
      //   })
      showInfo()
      .then(res => {
          this.loading = false;
          if (res.success == false) {
            this.$message({
              type: "info",
              message: res.msg
            });
          } else {
            this.listData = res.data;
            console.log(res.data)
            // 分页赋值
            this.pageparm.currentPage = this.formInline.page;
            this.pageparm.pageSize = this.formInline.limit;
            this.pageparm.total = res.count;
          }
      })
      .catch(err => {
          this.loading = false;
          this.$message.error("列表加载失败，请稍后再试！");
      });
    },
    // 分页插件事件
    callFather(parm) {
      this.formInline.page = parm.currentPage;
      this.formInline.limit = parm.pageSize;
      this.getdata(this.formInline);
    },
    // 搜索事件
    search() {
      this.getdata(this.formInline);
    },
    // 修改位置信息
    handleSetData(){
      this.editForm.longitude = sessionStorage.getItem('plLongitude');
      this.editForm.latitude = sessionStorage.getItem('plLatitude');
      this.setLocationVisible = false;
    },
    // 修改位置页面
    handleSetLocation: function(index,row){
      this.setLocationVisible = true;
      console.log(index)
    },
    // 展示信息
    handleShow: function (index, row) {
      this.showFormVisible = true;
      this.editForm = row;
    },
    //显示编辑界面
    handleEdit: function (index, row) {
      this.editFormVisible = true;
      this.editForm = row;
    },
    // 编辑、增加页面保存方法
    // submitForm(editData) {
    //   this.$refs[editData].validate(valid => {
    //     if (valid) {
    //       ConfigSave(this.editForm)
    //         .then(res => {
    //           this.editFormVisible = false
    //           this.loading = false
    //           if (res.success) {
    //             this.getdata(this.formInline)
    //             this.$message({
    //               type: 'success',
    //               message: '公司保存成功！'
    //             })
    //           } else {
    //             this.$message({
    //               type: 'info',
    //               message: res.msg
    //             })
    //           }
    //         })
    //         .catch(err => {
    //           this.editFormVisible = false
    //           this.loading = false
    //           this.$message.error('支付配置信息保存失败，请稍后再试！')
    //         })
    //     } else {
    //       return false
    //     }
    //   })
    // },
    // 删除公司
    // deleteUser(index, row) {
    //   this.$confirm('确定要删除吗?', '信息', {
    //     confirmButtonText: '确定',
    //     cancelButtonText: '取消',
    //     type: 'warning'
    //   })
    //     .then(() => {
    //       ConfigDelete(row.deptId)
    //         .then(res => {
    //           if (res.success) {
    //             this.$message({
    //               type: 'success',
    //               message: '公司已删除!'
    //             })
    //             this.getdata(this.formInline)
    //           } else {
    //             this.$message({
    //               type: 'info',
    //               message: res.msg
    //             })
    //           }
    //         })
    //         .catch(err => {
    //           this.loading = false
    //           this.$message.error('支付配置信息删除失败，请稍后再试！')
    //         })
    //     })
    //     .catch(() => {
    //       this.$message({
    //         type: 'info',
    //         message: '已取消删除'
    //       })
    //     })
    // },

    //关闭编辑、增加弹出框
    closeDialog(formName) {
      this.showFormVisible = false;
      this.editFormVisible = false;
      this.setLocationVisible = false;
      this.addFormVisiable = false;
      this.$refs[formName].resetFields();
    },
    //删除停车场
    deleteUser(index, row) {
      this.$confirm("确定要删除吗?", "信息", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      })
      .then(res => {
          // ConfigDelete(row.deptId)
          //   .then(res => {
          //     if (res.success) {
          //       this.$message({
          //         type: "success",
          //         message: "该停车场已删除!"
          //       });
          //       this.getdata(this.formInline);
          //     } else {
          //       this.$message({
          //         type: "info",
          //         message: res.msg
          //       });
          //     }
          //   })
          //   .catch(err => {
          //     this.loading = false;
          //     this.$message.error("删除失败，请稍后再试！");
          //   });
          delInfo(row.id).then(res=>{
              if (!res.success) {
                this.$message({
                  type: "success",
                  message: "该停车场已删除!"
                });
                this.getdata(this.formInline);
              } else {
                this.$message({
                  type: "info",
                  message: res.msg
                });
              }
          }).catch(err=>{
              this.loading = false;
              this.$message.error("删除失败，请稍后再试！");
          });
      })
      .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除"
          });
      });
    },
    // 上传修改的数据
    handlePutData(){
      console.log(this.editForm);
      managerInfo(this.editForm).then(res=>{
        if(!res.success){
          this.$message({
            type: "info",
            message: "修改成功"
          });
        }else {
          this.$message({
            type: "warning",
            message: res.msg
          });
        }
      }).catch(err=>{
        this.$message.error("发生错误,请稍后再试");
      });
    },
    // 新建数据
    enrollParking(){
      enrollInfo(this.enrollForm).then(res=>{
        if(res.success){
          this.$message({
            type: "info",
            message: "添加成功"
          });
        }else {
          this.$message({
            type: "warning",
            message: res.msg
          });
        }
      }).catch(err=>{
        this.$message.error(err)
      });
    },
    // 添加窗口显示
    handleAdd(){
      this.addFormVisiable = true;
      enrollInfo(this.editForm).then(res=>{
        if(res.success){
          this.$message({
            type: "info",
            message: "成功"
          });
        }else {
          this.$message({
            type: "warning",
            message: res.msg
          });
        }
      }).catch(err=>{
        this.$message.error("发生错误,请稍后再试");
      });
    },
    handleAvatarSuccess(res, file) {
        this.imageUrl = URL.createObjectURL(file.raw);
    },
    beforeAvatarUpload(file) {
        const isJPG = file.type === 'image/jpeg';
        const isLt2M = file.size / 1024 / 1024 < 2;

        if (!isJPG) {
          this.$message.error('上传图片只能是 JPG 格式!');
        }
        if (!isLt2M) {
          this.$message.error('上传图片大小不能超过 2MB!');
        }
        return isJPG && isLt2M;
    },
    selectParking(){
      this.selectParkingVisiable = true;


    }




  }
};
</script>

<style scoped>
  .user-search {
    margin-top: 20px;
  }

  .userRole {
    width: 100%;
  }
  .avatar-uploader .el-upload {
    border: 1px dashed #d9d9d9;
    border-radius: 6px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
  }
  .avatar-uploader .el-upload:hover {
    border-color: #409EFF;
  }
  .avatar-uploader-icon {
    font-size: 28px;
    color: #8c939d;
    width: 178px;
    height: 178px;
    line-height: 178px;
    text-align: center;
  }
  .avatar {
    width: 178px;
    height: 178px;
    display: block;
  }
</style>
